﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace ServerSide.Model
{
    public class Player : INotifyPropertyChanged
    {
        private string _name;
        private string _ipAddress;
        private int _score;
        private string _status;

        public string IDPlayer
        {
            get
            {
                return this._name + "@" + this._ipAddress;
            }
        }

        public string Name 
        {
            get { return this._name; }
            set
            {
                this._name = value;
                OnPropertyChanged("Name");
            }
        }

        public string IPAddress
        {
            get { return this._ipAddress; }
            set
            {
                this._ipAddress = value;
                OnPropertyChanged("IPAddress");
            }
        }

        public int Score
        {
            get { return this._score; }
            set
            {
                this._score = value;
                OnPropertyChanged("Score");
            }
        }

        public string Status
        {
            get { return this._status; }
            set
            {
                this._status = value;
                OnPropertyChanged("Status");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }

        public Player(string name, string ipaddress)
        {
            this._name = name;
            this._ipAddress = ipaddress;
            this._score = 0;
            this._status = "Connected";
        }
    }
}
